import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login.vue'),
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('../views/home.vue'),
    redirect: '/homepage',
    children: [
      {
        path: '/homepage',
        name: 'homepage',
        component: () => import('../views/homepage.vue'),
      },
      {
        path: '/members',
        name: 'members',
        component: () => import('../views/members.vue'),
      },
      {
        path: '/supplier',
        name: 'supplier',
        component: () => import('../views/supplier.vue'),
      },
      {
        path: '/goods',
        name: 'goods',
        component: () => import('../views/goods.vue'),
      },
      {
        path: '/employees',
        name: 'employees',
        component: () => import('../views/employees.vue'),
      },
    ]
  },
];

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
});

export default router;
